package com.ymttest.business.service;

import java.io.IOException;

import org.apache.http.client.ClientProtocolException;

import com.ymatou.iapi.captcha.parameter.GetValidateCodeBean;
import com.ymatou.iapi.captcha.service.GetValidateCodeCall;
import com.ymttest.utils.TestDataManager;

public class ValidateCodeServiceV2 {

	public static  GetValidateCodeBean setGetValidateCodeBean(String actionUser)
	{
		GetValidateCodeBean getvalidatecodeBean = new GetValidateCodeBean();
		
		getvalidatecodeBean.setValidationCodeType(1);
		getvalidatecodeBean.setLength(4);
		getvalidatecodeBean.setActionUser(actionUser);
		getvalidatecodeBean.setValidateType(1);
		
		return getvalidatecodeBean;
	}
	
	public static  GetValidateCodeBean setGetValidateCodeBean()
	{
		GetValidateCodeBean getvalidatecodeBean = new GetValidateCodeBean();
		
		getvalidatecodeBean.setValidationCodeType(0);
		getvalidatecodeBean.setLength(4);
		getvalidatecodeBean.setActionUser(TestDataManager.getRandomNum(6));
		getvalidatecodeBean.setValidateType(TestDataManager.getRandomIntNum(2));
		
		return getvalidatecodeBean;
	}
	
	/**
	 * 
	 * @param validationCodeType
	 * 验证码类型(0：数字字母混合 1：纯数字 2：纯字母 3：GUID, 详见枚举 ValidateCodeModel.ValidationCodeTypeEnum)
	 * @param ExpiredSeconds
	 * 有效期（秒）
	 * @param Length
	 * 验证码长度
	 * @param ActionUser
	 * 接收验证码的用户主体（例如Email、手机号、GUID 等）
	 * @param ValidateType
	 * 验证场景（更改账户、验证邮箱、充值密码等，详见枚举 ValidateCodeModel.ValidationType）
	 * /// <summary>
        /// 注册激活
        /// </summary>
        [Description("待提交sd审核")]
        RegActive = 1,

        /// <summary>
        /// </summary>
        [Description("待提交sd审核")]
        Getpass = 2,

        /// <summary>
        /// 更改邮箱
        /// </summary>
        [Description("更改邮箱")]
        ChangeMail = 3,

        /// <summary>
        /// v帐户激活
        /// </summary>
        [Description("v帐户激活")]
        VAccountActive = 4,

        /// <summary>
        /// 买手激活
        /// </summary>
        [Description("买手激活")]
        SellerActive = 9,

        /// <summary>
        ///第三方用户登陆密码重置
        /// </summary>
        [Description("第三方用户登陆密码重置")]
        ChangeThirdPartyLoginPassword = 10,

        /// <summary>
        /// 手机应用激活(买家邀请码)
        /// </summary>
        [Obsolete]
        [Description("手机应用激活")]
        AppPermission = 11,

        /// <summary>
        /// 重置密码
        /// </summary>
        [Description("重置密码")]
        ResetPassword = 12,

        /// <summary>
        /// 手机注册激活
        /// </summary>
        [Description("手机注册激活")]
        MobileRegActive = 13,

        /// <summary>
        /// 修改手机
        /// </summary>
        [Description("修改手机")]
        ModifyMobile = 14,

        /// <summary>
        /// 修改邮箱
        /// </summary>
        [Description("修改邮箱")]
        ModifyEmail = 15,

        /// <summary>
        /// 绑定手机
        /// </summary>
        [Description("绑定手机")]
        BindMobile = 16,
        /// <summary>
        /// 图片验证码
        /// </summary>
        [Description("图片验证码")]
        ImgValidateCode = 99
	 * @return
	 */
	public static GetValidateCodeBean setGetValidateCodeBean(Integer validationCodeType,Integer expiredSeconds, Integer length,String actionUser,Integer validateType)
	{
		GetValidateCodeBean getvalidatecodeBean = new GetValidateCodeBean();
		
		getvalidatecodeBean.setValidationCodeType(validationCodeType);
		getvalidatecodeBean.setExpiredSeconds(expiredSeconds);
		getvalidatecodeBean.setLength(length);
		getvalidatecodeBean.setActionUser(actionUser);
		getvalidatecodeBean.setValidateType(validateType);
		
		return getvalidatecodeBean;
	}
	
	public static GetValidateCodeCall GetValidateCode(GetValidateCodeBean getValidateCodeBean) throws ClientProtocolException, IOException
	{
		GetValidateCodeCall getvalidatecodeCall = new GetValidateCodeCall();

		getvalidatecodeCall.setData(getValidateCodeBean);
		getvalidatecodeCall.callService();		
		
		return getvalidatecodeCall;
	}
}
